

/**
 * @file    wifi_init.h
 * @author  Azolla (1228449928@qq.com)
 * @brief   
 * @version 0.1
 * @date    2023-02-06
 * 
 * @copyright Copyright (c) 2023
 * */
#ifndef __WEBSOCKET_H__
#define __WEBSOCKET_H__

#include "mac_utils.h"
#include "esp_websocket_client.h"

typedef struct {
    // const char *value;
    uint8_t *value;
    uint16_t size;
} wss_data_t;
 
typedef void (*websocket_data_callback_t)(wss_data_t);
void websocket_register_callback(websocket_data_callback_t cb);

void websocket_init(void);

void websocket_client_stop(void);

void websocket_client_start(void);

bool websocket_client_is_connected(void);

void websocket_client_close(uint32_t timeout);

void websocket_client_set_url(const char *uri);

int websocket_client_send_text(const char *data, int len, TickType_t timeout);

#endif  /*__WEBSOCKET_H__ END.*/